using System.IO;
using System.IO.IsolatedStorage;

namespace WindowsPhoneEssentials.Abstractions
{
    public class IsolatedStorageFileWrapper : IIsolatedStorageFile
    {
        private readonly IsolatedStorageFile isolatedStorageFile;

        public IsolatedStorageFileWrapper(IsolatedStorageFile isolatedStorageFile)
        {
            this.isolatedStorageFile = isolatedStorageFile;
        }

        public long Quota
        {
            get { return isolatedStorageFile.Quota; }
        }

        public long AvailableFreeSpace
        {
            get { return isolatedStorageFile.AvailableFreeSpace; }
        }

        public void Remove()
        {
            isolatedStorageFile.Remove();
        }

        public bool IncreaseQuotaTo(long newQuotaSize)
        {
            return isolatedStorageFile.IncreaseQuotaTo(newQuotaSize);
        }

        public void DeleteFile(string file)
        {
            isolatedStorageFile.DeleteFile(file);
        }

        public bool FileExists(string path)
        {
            return isolatedStorageFile.FileExists(path);
        }

        public bool DirectoryExists(string path)
        {
            return isolatedStorageFile.DirectoryExists(path);
        }

        public void CreateDirectory(string dir)
        {
            isolatedStorageFile.CreateDirectory(dir);
        }

        public void DeleteDirectory(string dir)
        {
            isolatedStorageFile.DeleteDirectory(dir);
        }

        public string[] GetFileNames()
        {
            return isolatedStorageFile.GetFileNames();
        }

        public string[] GetFileNames(string searchPattern)
        {
            return isolatedStorageFile.GetFileNames(searchPattern);
        }

        public string[] GetDirectoryNames()
        {
            return isolatedStorageFile.GetDirectoryNames();
        }

        public string[] GetDirectoryNames(string searchPattern)
        {
            return isolatedStorageFile.GetDirectoryNames(searchPattern);
        }

        public Stream OpenFile(string path, FileMode mode)
        {
            return isolatedStorageFile.OpenFile(path, mode);
        }

        public Stream OpenFile(string path, FileMode mode, FileAccess access)
        {
            return isolatedStorageFile.OpenFile(path, mode, access);
        }

        public Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
        {
            return isolatedStorageFile.OpenFile(path, mode, access, share);
        }

        public Stream CreateFile(string path)
        {
            return isolatedStorageFile.CreateFile(path);
        }

        public void Dispose()
        {
            isolatedStorageFile.Dispose();
        }
    }
}